<{include file="Common/head"}>
<{include file="Common/menu"}>




<link href="_index_/yy/index.css" rel="stylesheet">
<link href="_index_/yy/laydate.css" rel="stylesheet">
<script src="_index_/yy/laydate.js"></script>
<script type="text/javascript" src="_index_/laydate/laydate.js"></script>
<style type="text/css">
 .submit,.reset{    cursor: pointer;}
	#test-limit3{
	    width: 40%;
		height: 30px;
		padding: 2px 5px;
		font-size: 18px;
		color: #555;
	}
</style>

<section class="Hui-article-box">

    <form class="appointment">
        <ul>
            <li>
                <h2>预约日期：</h2>
                <div class="laydate-box">
                    <input type="text" id="laydateInput"/>
                    <div class="select-date">
                        <div class="select-date-header">
                            <ul class="heade-ul">
                                <li class="header-item header-item-one">
                                    <select name="" id="yearList">
                                    </select>
                                </li>
                                <li class="header-item header-item-two" onselectstart="return false">
                                    <select name="" id="monthList">
                                    </select>
                                </li>
                                <li class="header-item header-item-three" onselectstart="return false" > <span class="reback">回到今天</span> </li>
                            </ul>
                        </div>
                        <div class="select-date-body">
                            <ul class="week-list">
                                <li>日</li>
                                <li>一</li>
                                <li>二</li>
                                <li>三</li>
                                <li>四</li>
                                <li>五</li>
                                <li>六</li>
                            </ul>
                            <ul class="day-tabel">
                            </ul>
                        </div>
                    </div>
                </div>
            </li>
            <li>
                <h2>房&ensp;&ensp;&ensp;&ensp;间：</h2>
                <select class="room">
                    <option value="房间1">房间1</option>
                    <option value="房间2">房间2</option>
                    <option value="房间3">房间3</option>
                </select>
            </li>
            <li>
                <h2>时&ensp;&ensp;&ensp;&ensp;间：</h2>
                <input type="text" class="layui-input time" id="test-limit3" placeholder="时:分:秒">

            </li>
            <li>
                <h2>顾客姓名：</h2>
                <input class="name" type="text" value="<{$data.name}>" onfocus="if (value =='顾客姓名'){value =''}" onblur="if (value ==''){value='顾客姓名'}"/>
            </li>

            <li>
                <h2>渠&ensp;&ensp;&ensp;&ensp;道：</h2>
                <select class="channel">
                    <option value="市场部">市场部</option>
                    <option value="电网竞价">电网竞价</option>
                    <option value="新媒体—新氧">新媒体—新氧</option>
                    <option value="新媒体—更美">新媒体—更美</option>
                    <option value="新媒体—美团">新媒体—美团</option>
                    <option value="新媒体—大众">新媒体—大众</option>
                    <option value="新媒体—天猫">新媒体—天猫</option>
                    <option value="新媒体—悦美">新媒体—悦美</option>
                </select>
            </li>
            <li>
                <h2>脱毛部位：</h2>

                    <div class="position skin-minimal">
            <div class="check-box"><input type="checkbox" name="position" value="络腮胡" id="b_1"> <label for="b_1">络腮胡</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="双前臂" id="b_2"> <label for="b_2">双前臂</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="双大腿" id="b_3"> <label for="b_3">双大腿</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="双小腿" id="b_4"> <label for="b_4">双小腿</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="两鬓毛" id="b_5"> <label for="b_5">两鬓毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="面颊毛" id="b_6"> <label for="b_6">面颊毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="双腋毛" id="b_7"> <label for="b_7">双腋毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="上唇毛" id="b_8"> <label for="b_8">上唇毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="下唇毛" id="b_9"> <label for="b_9">下唇毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="下颌毛" id="b_10"> <label for="b_10">下颌毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="腹直线" id="b_11"> <label for="b_11">腹直线</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="肚脐周" id="b_12"> <label for="b_12">肚脐周</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="发际线" id="b_13"> <label for="b_13">发际线</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="颈部毛" id="b_14"> <label for="b_14">颈部毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="肩胛上" id="b_15"> <label for="b_15">肩胛上</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="下背毛" id="b_16"> <label for="b_16">下背毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="前额毛" id="b_17"> <label for="b_17">前额毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="手背" id="b_18"> <label for="b_18">手背</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="手指" id="b_19"> <label for="b_19">手指</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="脚趾" id="b_20"> <label for="b_20">脚趾</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="脚背" id="b_21"> <label for="b_21">脚背</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="眉毛" id="b_22"> <label for="b_22">眉毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="私密" id="b_23"> <label for="b_23">私密</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="脸毛" id="b_24"> <label for="b_24">脸毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="胸毛" id="b_25"> <label for="b_25">胸毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="后腰部毛" id="b_26"> <label for="b_26">后腰部毛</label></div>
            <div class="check-box"><input type="checkbox" name="position" value="下腹部毛" id="b_27"> <label for="b_27">下腹部毛</label></div>

                    </div>

            </li>
            <li>
                <h2>预计时长：</h2>
                <select class="lengthtime">
                    <option value="10分钟">10分钟</option>
                    <option value="15分钟">15分钟</option>
                    <option value="20分钟">20分钟</option>
                    <option value="25分钟">25分钟</option>
                    <option value="30分钟">30分钟</option>
                    <option value="40分钟">40分钟</option>
                    <option value="45分钟">45分钟</option>
                    <option value="50分钟">50分钟</option>
                    <option value="1小时">1小时</option>
                </select>
            </li>
            <li>
                <h2>治&ensp;疗&ensp;师：</h2>
                <div class="physician">
                    <div class="check-box"><input type="checkbox" name="doctor" value="李颗辉" id="z_1"> <label for="z_1">李颗辉</label></div>
                    <div class="check-box"><input type="checkbox" name="doctor" value="张鸣芳" id="z_2"> <label for="z_2">张鸣芳</label></div>
                    <div class="check-box"><input type="checkbox" name="doctor" value="温会娟" id="z_3"> <label for="z_3">温会娟</label></div>
                </div>
            </li>
            <li>
                <h2>备&ensp;&ensp;&ensp;&ensp;注：</h2>
                <textarea class="message" name="message" rows="5"><{$data.content}></textarea>
            </li>

            <li><button type="button" class="submit">提交</button><button type="reset">重置</button></li>
        </ul>
    </form>

</section>

<script>
$(function(){

	//限定可选时间
    laydate.render({
        elem: '#test-limit3'
        ,type: 'time'
        ,min: '09:00:00'
        ,max: '20:00:00'
        ,btns: ['clear', 'confirm']
    });

    //设置表单的值
    $(".room").val("<{$data.zhiliaoshi}>");
    $(".channel").val("<{$data.from}>");
    $(".time").val("<{$data.shijian}>");
    $(".lengthtime").val("<{$data.spendtime}>");
   // $(".physician input[value='李颗辉']").attr("checked",true);
    <?php
            foreach(json_decode($data['doctor']) as $v){
                echo "$(\".physician input[value='"."$v"."']\").attr('checked',true);";
            }

    foreach(json_decode($data['buwei']) as $v){
        echo "$(\".position input[value='"."$v"."']\").attr('checked',true);";
    }
    ?>


    //重置
    $(".reset").click(function() {
        $(".appointment")[0].reset();
    });



    $(".submit").on("click",function(){

        obj = document.getElementsByName("position");
        check_val = [];
        for(k in obj){
            if(obj[k].checked)
                check_val.push(obj[k].value);
        }

        obj = document.getElementsByName("doctor");
        doctor_val = [];
        for(k in obj){
            if(obj[k].checked)
                doctor_val.push(obj[k].value);
        }

        if(check_val.length==0){
            alert("治疗部位必选");
            return false;
        }

        if(doctor_val.length==0){
            alert("医生选项必选");
            return false;
        }

        date        = $("#laydateInput").val(); //预约日期
        room        = $(".room").val();        //治疗房间号
        time        = $(".time").val();        //治疗时间 几点钟
        name        = $(".name").val();        //顾客姓名
        channel     = $(".channel").val();        //渠道
        position    = check_val;        //治疗位置
        lengthtime  = $(".lengthtime").val();        //预计时长
        physician   = doctor_val;        //治疗师
        message     = $(".message").val();        //留言

        var postdata = {
            "id":<{$data.d_id}>,
            "date":date,
            "room":room,
            "time":time,
            "name":name,
            "channel":channel,
            "position":position,
            "lengthtime":lengthtime,
            "physician":physician,
            "message":message
        };

        $.post("/index/Index/modifydata",postdata,function(e){
console.log(e);
            if(e=="success"){
                $.Huimodalalert('更新成功',2000);
                setInterval('window.location.href="/index/Index/listdata"',2000);

            }else{

            }
        });


    });

    //弹出式添加页面，隐藏左边菜单栏
    $("body").addClass("big-page");
    $(".dislpayArrow").css("display","none");
    $(".navbar-wrapper").css("display","none");

});

function getSelectDate(result){
    console.log(result);
}

</script>
<{include file="Common/footer"}>